<template>
  <div>
    <!-- insert -->
    <el-form :model="ruleForm" status-icon  label-width="100px" class="demo-ruleForm" style="margin-top:30px;width: 30%;">
            <el-form-item label="姓名" prop="pass">
                <el-input type="text" v-model="ruleForm.name" ></el-input>
            </el-form-item>
            <el-form-item label="年龄" prop="checkPass">
                <el-input type="text" v-model="ruleForm.age" ></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
            </el-form-item>
        </el-form>
  </div>
</template>

<script>
import axios from 'axios'

export default {
    name:"insert",
    data(){
        return {
            ruleForm:{
                name:'',
                age:''
            }
        };
    },
    methods:{
        submitForm(formName) {
            this.$refs[formName].validate((valid) => {
                if (valid) {
                    alert("submit!");
                }else{
                    console.log('error submit!');
                    return false;
                }
            });
        }
    }
}
</script>

<style>

</style>